package com.gly091020.MaidCode.mixin;

import com.github.tartaricacid.touhoulittlemaid.entity.chatbubble.ChatBubbleManager;
import com.github.tartaricacid.touhoulittlemaid.entity.chatbubble.implement.WaitingChatBubbleData;
import com.gly091020.MaidCode.MaidCode;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ChatBubbleManager.class)
public class ProgressMixin {
    @Redirect(method = "addThinkingText", at = @At(value = "INVOKE", target = "Lcom/github/tartaricacid/touhoulittlemaid/entity/chatbubble/implement/WaitingChatBubbleData;create(ILnet/minecraft/resources/ResourceLocation;ILnet/minecraft/network/chat/Component;Lnet/minecraft/resources/ResourceLocation;)Lcom/github/tartaricacid/touhoulittlemaid/entity/chatbubble/implement/WaitingChatBubbleData;"))
    public WaitingChatBubbleData setTime(int existTick, ResourceLocation bg, int priority, Component text, ResourceLocation icon){
        // 943怎么也想不到有人会让女仆写代码
        if(!MaidCode.CONFIG.fixChatBubble){return WaitingChatBubbleData.create(existTick, bg, priority, text, icon);}
        return WaitingChatBubbleData.create(Integer.MAX_VALUE, bg, priority, text, icon);
    }
}
